import Vue from 'vue';
import App from './App.vue';
import ElementUI from 'element-ui';
import socketIO from 'socket.io-client';
import VueSocketIO from 'vue-socket.io';
import VueParticles from 'vue-particles';
import router from '@/router/index.js';
import config from '@/config/base.json';
import '@/common/fonts/font.css';
import '@/common/styles/main.css';
import 'element-ui/lib/theme-chalk/index.css';

// 注册全局变量
Vue.prototype.$audioList = [
  require('@/audio/down.wav'),
  require('@/audio/eat.mp3'),
  require('@/audio/jiangjun.mp3'),
  require('@/audio/click.wav')
];

// SocketIO
Vue.use(new VueSocketIO({
  // debug: true,
  connection: socketIO(config.baseUrl + config.socketUri),
  extraHeaders: {'Access-Control-Allow-Origin': '*'}
}));
// ElementUI组件库
Vue.use(ElementUI);
// 粒子特效
Vue.use(VueParticles);

// 配置Vue模式
// Vue.config.debug = true;
Vue.config.productionTip = false;

// eslint-disable-next-line no-new
new Vue({
  el: '#app',
  router,
  components: {App},
  template: '<App/>'
});
